package thread;

public class Producter implements Runnable{

	public static Apple[] s;

	public Producter(){
		
	}
	
	public Producter(Apple[] s){
		this.s = s;
	}

	@Override
	public void run() {
		int num = 1;
		
		for(int i= 0;i<s.length;i++){
			num ++;
			if(s[i]==null){
				this.notify();
				s[i]=new Apple();
				break;
			}
		}
		
		if(num==s.length){
			try {
				this.wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			
		}
	}

	
}
